﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.60    贷款展期信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_COL_LOANEXT: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_COL_LOANEXT()
		{}
		#region Model
		private long _id;
		private long _loanid;
		private long _proid;
		private long _conid;
		private int _startphase;
		private Nullable<DateTime> _enddate;
		private decimal _amt;
		private decimal _rate;
		private decimal _managefeerate;
		private decimal _generalrate;
		private decimal _delayrate;
		private int _loanphasetype;
		private string _applyby;
		private Nullable<DateTime> _applydate;
		private string _touser;
		private string _review;
		private string _remark;
		private int _status;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 放款记录IDTb_Loan_Main.ID
		/// </summary>
		[DataMember]
		public long LOANID
		{
			get{return _loanid;}
			set{
				if ( _loanid!= value)
				{
					 _loanid = value;
					OnPropertyChanged("LOANID");
				}
			}
		}
		/// <summary>
		/// 立项申请记录ID
		/// </summary>
		[DataMember]
		public long PROID
		{
			get{return _proid;}
			set{
				if ( _proid!= value)
				{
					 _proid = value;
					OnPropertyChanged("PROID");
				}
			}
		}
		/// <summary>
		/// 合同记录ID
		/// </summary>
		[DataMember]
		public long CONID
		{
			get{return _conid;}
			set{
				if ( _conid!= value)
				{
					 _conid = value;
					OnPropertyChanged("CONID");
				}
			}
		}
		/// <summary>
		/// 展期开始期数
		/// </summary>
		[DataMember]
		public int STARTPHASE
		{
			get{return _startphase;}
			set{
				if ( _startphase!= value)
				{
					 _startphase = value;
					OnPropertyChanged("STARTPHASE");
				}
			}
		}
		/// <summary>
		/// 展期后到期日
		/// </summary>
		[DataMember]
		public Nullable<DateTime> ENDDATE
		{
			get{return _enddate;}
			set{
				if ( _enddate!= value)
				{
					 _enddate = value;
					OnPropertyChanged("ENDDATE");
				}
			}
		}
		/// <summary>
		/// 展期金额
		/// </summary>
		[DataMember]
		public decimal AMT
		{
			get{return _amt;}
			set{
				if ( _amt!= value)
				{
					 _amt = value;
					OnPropertyChanged("AMT");
				}
			}
		}
		/// <summary>
		/// 展期贷款利率
		/// </summary>
		[DataMember]
		public decimal RATE
		{
			get{return _rate;}
			set{
				if ( _rate!= value)
				{
					 _rate = value;
					OnPropertyChanged("RATE");
				}
			}
		}
		/// <summary>
		/// 展期管理费率
		/// </summary>
		[DataMember]
		public decimal MANAGEFEERATE
		{
			get{return _managefeerate;}
			set{
				if ( _managefeerate!= value)
				{
					 _managefeerate = value;
					OnPropertyChanged("MANAGEFEERATE");
				}
			}
		}
		/// <summary>
		/// 展期综合费率
		/// </summary>
		[DataMember]
		public decimal GENERALRATE
		{
			get{return _generalrate;}
			set{
				if ( _generalrate!= value)
				{
					 _generalrate = value;
					OnPropertyChanged("GENERALRATE");
				}
			}
		}
		/// <summary>
		/// 展期逾期利率
		/// </summary>
		[DataMember]
		public decimal DELAYRATE
		{
			get{return _delayrate;}
			set{
				if ( _delayrate!= value)
				{
					 _delayrate = value;
					OnPropertyChanged("DELAYRATE");
				}
			}
		}
		/// <summary>
		/// 展期还款方式具体参考” 还款计息方式”文档
		/// </summary>
		[DataMember]
		public int LOANPHASETYPE
		{
			get{return _loanphasetype;}
			set{
				if ( _loanphasetype!= value)
				{
					 _loanphasetype = value;
					OnPropertyChanged("LOANPHASETYPE");
				}
			}
		}
		/// <summary>
		/// 申请人
		/// </summary>
		[DataMember]
		public string APPLYBY
		{
			get{return _applyby;}
			set{
				if ( _applyby!= value)
				{
					 _applyby = value;
					OnPropertyChanged("APPLYBY");
				}
			}
		}
		/// <summary>
		/// 申请日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> APPLYDATE
		{
			get{return _applydate;}
			set{
				if ( _applydate!= value)
				{
					 _applydate = value;
					OnPropertyChanged("APPLYDATE");
				}
			}
		}
		/// <summary>
		/// 提交到
		/// </summary>
		[DataMember]
		public string TOUSER
		{
			get{return _touser;}
			set{
				if ( _touser!= value)
				{
					 _touser = value;
					OnPropertyChanged("TOUSER");
				}
			}
		}
		/// <summary>
		/// 展期评审条件
		/// </summary>
		[DataMember]
		public string REVIEW
		{
			get{return _review;}
			set{
				if ( _review!= value)
				{
					 _review = value;
					OnPropertyChanged("REVIEW");
				}
			}
		}
		/// <summary>
		/// 备注
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}
		/// <summary>
		/// 状态0保存，1提交，2同意，3拒绝
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

